LGF_CalcDistance_2D (FC / 3.0.1)

Overview

Author: Siemens Digital Industries

Short description

The function calculates the distance between two points in the plane.

Block Interface

LGF_CalcDistance_2D (FC)
LReal  x1 Ret_Val  LReal
    
LReal  y1   
    
LReal  x2   
    
LReal  y2   
    
   

Input parameter

IdentifierData type Description
x1LReal X coordinate point 1
y1LReal Y coordinate point 1
x2LReal X coordinate point 2
y2LReal Y coordinate point 2

Output parameter

IdentifierData type Description
Ret_ValLReal Calculated distance between the Points

Functional description

The block calculates the distance between two points in a Cartesian coordinate system. The distance is calculated with the following formula:

result = \sqrt[2]{(x_2-x_1)^2+(y_2-y_1)^2}

Figure: Graphical representation

LGF_CalcDistance_2D - Principle of operation

Change log

Version & DateChange description
1.0.0Siemens Industry Online Support
06.07.2018First released version
1.0.1Siemens Industry Online Support
17.08.2018Upgrade: TIA V15 Update 2
1.0.2Siemens Industry Online Support
23.11.2018Upgrade: TIA V15.1
1.2.0Simatic Systems Support
04.10.2019renamed from "Distance" to "CalcDistance_2D"
Data type changed to LREAL
Data type changed to LREAL
3.0.0Simatic Systems Support
23.04.2020Set version to V3.0.0, harmonize the version of the whole library
3.0.1Simatic Systems Support
12.11.2020Insert documentation